import Vue from 'vue'
import moment from 'moment'

export default {
  async list (data) {
    return Vue.http.post('./gxActivityPunchClock/getPunchClockList', data)
  },

  // 创建
  async create (data) {
    let params = Object.assign({}, data)
    params.openTime = moment(params.openTime).format('YYYY-MM-DD HH:mm:ss')
    params.closeTime = moment(params.openTime).format('YYYY-MM-DD HH:mm:ss')
    return Vue.http.post('./gxActivityPunchClock/savePunchClock', params)
  },

  // 更新
  async update (data) {
    let params = Object.assign({}, data)
    params.openTime = moment(params.openTime).format('YYYY-MM-DD HH:mm:ss')
    params.closeTime = moment(params.openTime).format('YYYY-MM-DD HH:mm:ss')
    return Vue.http.post('./gxActivityPunchClock/editPunchClock', params)
  },

  // 删除
  async remove (data) {
    return Vue.http.post('./gxActivityPunchClock/delPunchClock', data)
  }
}
